(defun C:MKPATH ()
  (defun cend (c_ent)
    (list (+ (cadr (assoc 10 c_ent)) (cdr (assoc 40 c_ent)))
          (caddr (assoc 10 c_ent))
          ;;(cadddr (assoc 10 c_ent))
    )
  )
  (setq ci1 (entget (ssname (ssget ":S" '((0 . "CIRCLE"))) 0)))
  (while t
    (setq ci1 (entget (ssname (ssget "P") 0)))
    (setq ci2 (entget (ssname (ssget ":S" '((0 . "CIRCLE"))) 0)))

    (setq ci1end (cend ci1))
    (setq ci2end (cend ci2))
    (setq ci2start (list
                     (if (> (cdr (assoc 40 ci2)) 5)
                       (- (car ci2end) 5)
                       (cadr (assoc 10 ci2))
                     )
                     (cadr ci2end)
                     ;;(caddr ci2end)
                   )
    )
    (command "_line" ci1end ci2start "")
  )
  (princ)
)